﻿using System;
using UnityEngine;

namespace Snake.Gameplay
{
    public class GameplayAnimationComponent : MonoBehaviour
    {
        private GameplayAbilityComponent Owner { get; set; }

        private void Awake()
        {
            Owner = GetComponentInParent<GameplayAbilityComponent>();
            if (!Owner)
            {
                throw new NotSupportedException("Owner is not exist.");
            }
        }

        public void TriggerTag(string triggerTag)
        {
            Owner.BroadcastEvent(new GameplayTriggerTagEvent
            {
                Tag = triggerTag
            });
        }
    }
}